package Offer2017;

import java.util.Stack;

/**
 * 两个栈实现队列
 * Created by 雷文康 on 2017/12/28.
 */
public class Test07 {
    Stack<Integer> stack1 = new Stack();
    Stack<Integer> stack2 = new Stack();

    public void push(int value){
         stack1.push(value);
    }

    public int pop(){
        if(stack2.isEmpty()) {
            while (!stack1.isEmpty()) {
                stack2.push(stack1.pop());
            }
        }
        if (stack2.isEmpty()) {
            System.out.println("数组为空！");
        }
        return stack2.pop();
    }
}

